package com.jshongli.myapplication.inspect;

import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.listener.CustomTabEntity;
import com.jshongli.myapplication.R;
import com.jshongli.myapplication.base.BaseActivity;
import com.jshongli.myapplication.inspect.fragment.PatrolEventFragment;
import com.jshongli.myapplication.inspect.fragment.PatrolSignFragment;
import com.jshongli.myapplication.model.base.TabEntity;

import java.util.ArrayList;

import butterknife.BindView;

public class EventActivity extends BaseActivity {

    public static EventActivity mActivity;

    @BindView(R.id.tb)
    CommonTabLayout tb;

    private String[] mTitles = {};
    private ArrayList<Fragment> mFragments = new ArrayList<>();

    private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>();

    @Override
    protected int getLayoutId() {
        return R.layout.activity_event;
    }

    @Override
    protected void initData() {
        super.initData();
        mActivity = this;
    }

    @Override
    protected void initView() {
        super.initView();

        mToolbar.setTitle("巡查详情");
        mTitles =new String[] {"代维事件","签到记录"};
        mFragments.add(new PatrolEventFragment(getIntent().getStringExtra("id")));
        mFragments.add(new PatrolSignFragment(getIntent().getStringExtra("id")));
        initToolbarBack(mToolbar);
        for (int i = 0; i < mTitles.length; i++) {
            mTabEntities.add(new TabEntity(mTitles[i]));
        }

        tb.setTabData(mTabEntities, this, R.id.fl, mFragments);
        tb.setCurrentTab(0);
    }
}